class TradeTemplate:
    def __init__(self, *args, **kwargs):
        self.partner = None
        self.seller = None
        self.tradeNO = None
        self.subject = None
        self.body = None
        self.amount = None
        self.notifyURL = None
        self.service = None
        self.paymentType = None
        self.inputCharset = None
        self.itBPay = None
        self.showUrl = None
        self.rsaDate = None
        self.appID = None
        self.extraParams = {}

    def to_url(self):
        url = ""
        if self.partner:
            url += 'partner="{}"'.format(self.partner)
        if self.seller:
            url += '&seller_id="{}"'.format(self.seller)
        if self.tradeNO:
            url += '&out_trade_no="{}"'.format(self.tradeNO)
        if self.subject:
            url += '&subject="{}"'.format(self.subject)
        if self.body:
            url += '&body="{}"'.format(self.body)
        if self.amount:
            url += '&total_fee="{}"'.format(self.amount)
        if self.notifyURL:
            url += '&notify_url="{}"'.format(self.notifyURL)
        if self.service:
            url += '&service="{}"'.format(self.service)
        if self.paymentType:
            url += '&payment_type="{}"'.format(self.paymentType)
        if self.inputCharset:
            url += '&_input_charset="{}"'.format(self.inputCharset)
        if self.itBPay:
            url += '&it_b_pay="{}"'.format(self.itBPay)
        if self.showUrl:
            url += '&show_url="{}"'.format(self.showUrl)
        if self.rsaDate:
            url += '&sign_date="{}"'.format(self.rsaDate)
        if self.appID:
            url += '&app_id="{}"'.format(self.appID)
        for key in self.extraParams:
            url += '&{}="{}"'.format(key, self.extraParams[key])
        return url

